<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <link rel="stylesheet" href="../static/layui/css/layui.css">
    <script src="../static/layui/layui.js"></script>
    <script src="../static/js/jquery.min.js"></script>
    <script src="../static/xm-select-master/dist/xm-select.js"></script>
</head>
<body>
    <form class="layui-form layui-form-pane" action="{% url 'iymm' %}" method="post" enctype="multipart/form-data" >
        {% csrf_token %}
        <div class="iymm-ndkh">
            <h2>注册</h2>
            <p>注册之后不可更改</p>
            <p>{{a}}</p>
        </div>
        <div>
            <input type="file" name="iymm_img" autocomplete="off" onchange="changeFile()" id="File" class="input_1">
            <img src="" width="40px" id="image" height="40px">
        </div> 
        <input type="text" name="name" placeholder="昵称" autocomplete="off">
        <input type="text" name="user" placeholder="用户名" autocomplete="off">
        <input type="password" name="password1" id="password1" placeholder="密码" autocomplete="off">
        <input type="password" name="password2" id="password2" placeholder="确认密码" onchange="dqpgPasswod()" autocomplete="off">
        <button 	class="layui-btn layui-btn-primary layui-border-green">注册</button>
    </form>
</body>
<style>
    body{
        background:url('../static/img/dl.png') no-repeat center center;
        background-size: cover;
        background-attachment: fixed;
        background-color: #CCCCCC;
    }
    form{
        width:300px;
        height:400px;
        margin:0 auto;
        margin-top:150px;
        background-color: rgba(0, 255, 255, 0.41);
        border-radius: 30px;
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        align-items: center;
    }
    input{
        width:200px;
        height:30px;
        border:0;
        border-radius: 15px;
        font-size: 18px;
        text-align: center;
        background-color: rgba(240, 248, 255, 0.445);
    }
    .input_1{
        border-radius:0;
    }
    .iymm-ndkh{
        display: flex;
        flex-direction: column;
        align-items: center;
    }
</style>
<script>
    function changeFile() {
        var image = document.getElementById("image");
        var address = document.getElementById("File").value;
        var name = document.getElementById("File").files[0];
        if (window.URL != undefined && name) {
            url = window.URL.createObjectURL(name);
        }
        image.src = url;
    }
    function dqpgPasswod(){
        var password1 = $("#password1").val()
        var password2 = $("#password2").val()
        console.log(password1)
        if(password1!=password2){
            layer.msg("两次密码不一致")
            document.getElementById("password2").value=''
        }
    }
</script>
</html>